package com.jiyun.controller;


import com.jiyun.result.Result;
import com.jiyun.result.ResultCodeEnum;
import com.jiyun.service.IDriverPerformanceService;
import com.jiyun.statistical.pojo.DriverPerformance;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-02-12
 */
@RestController
@RequestMapping("/performance")
public class DriverPerformanceController {
    @Autowired
    private IDriverPerformanceService driverPerformanceService;

        @Operation(summary = "查询所有司机的绩效")
        @PostMapping("/findPerformanceAll/{pageNum}/{pageSize}")
        public Result findPerformanceAll(DriverPerformance driverPerformance, @PathVariable Integer pageNum, @PathVariable Integer pageSize) {
            // 使用 PageHelper 进行分页查询
//            PageHelper.startPage(pageNum, pageSize);
//            List<DriverPerformance> driverPerformance = driverPerformanceService.list();
//            PageInfo<DriverPerformance> pageInfo = new PageInfo<>(driverPerformance);
//            return Result.ok(pageInfo);

            return Result.build(driverPerformanceService.findPerformanceAll(driverPerformance,pageNum,pageSize), ResultCodeEnum.SUCCESS);

        }

}
